<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<script type="text/javascript" src="<%=basePath %>js/jquery.js"></script>
<script type="text/javascript" src="<%=basePath %>js/jquery.json-2.4.min.js"></script>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'checkPW.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

	<script type="text/javascript">
	
	$(function (){
		var fc = ${paper.isjava};
		if(fc==0)
			$("#isjava").text("JAVA");
		else
			$("#isjava").text("C++");
	})
	
	function intoExam(){
		var pid = ${paper.id};
		var pw = $("#password").val();
		$.get("<%=request.getContextPath()%>/Paper/PaperAction!checkpw.action?password="+pw+"&id="+pid, null, callback)
	}
	
	function callback(data){
		var pid = ${paper.id};
		var type = ${paper.isjava};
		if(data=="yes"){
			window.location.href="<%=request.getContextPath()%>/Exam/ExamAction!pwbeginExam.action?id="+pid+"&type="+type;
		}
		else
			{
			   $("#errorinfo").text("error!!");
			}
		
	}
	
	</script>

  </head>
  
  <body>
    
	<table width="30%" border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce">
		<tr>
			 <td width="30%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">考试编号 </span></div></td>
			 <td height="20" bgcolor="d3eaef" class="STYLE19"><div align="center">${paper.id }  </div></td>
		</tr>
		<tr>
			 <td width="30%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">考试名称</span></div></td>
			 <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="left"> ${paper.papername } </div></td>
		</tr>
		<tr>
			 <td width="30%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">开始时间</span></div></td>
			 <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="left"> ${paper.begintime } </div></td>
		</tr>
		<tr>
			 <td width="30%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">结束时间</span></div></td>
			 <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="left"> ${paper.endtime }</div></td>
		</tr>
		<tr>
			 <td width="30%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">类型</span></div></td>
			 <td height="20" bgcolor="#FFFFFF" class="STYLE19"> 
			 <span id ="isjava"></span>
			 
			 </td>
		</tr>
		<tr>
			 <td width="30%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">输入考试密码</span></div></td>
			 <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="left">  
			 <input type="text" id="password" />  <span id="errorinfo" style="color:red"></span>
			 </div></td>
		</tr>
		
			<td width="30%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10"> <input type="button" value="进入考试"  onclick = "intoExam()"/></span></div></td>
			<td height="20"  class="STYLE19"><div align="center"><input type="button" value="返回" onclick="history.back()"/> </div></td>
		
	</table>
  </body>
</html>
